package com.kaishengit.service;

import java.util.List;

import com.kaishengit.dao.TaskDao;
import com.kaishengit.entity.Member;
import com.kaishengit.entity.Task;
import com.kaishengit.util.GetTime;
import com.kaishengit.util.Pager;

public class TaskService {

	TaskDao tdao = new TaskDao();
	public Task findById(String tid) {
		return tdao.findById(tid);
	}
	public void insert(String name, String begin, String end, String dec,
			String state, String level, String manager, String gid, String mid,String rate) {
		Task t = new Task();
		String tid = GetTime.getTime();
		t.setT_id(tid);
		t.setT_name(name);
		t.setT_begin(begin);
		t.setT_end(end);
		t.setT_stat(state);
		t.setT_dec(dec);
		t.setT_level(level);
		t.setT_rate(rate);
		t.setManager(manager);
		t.setT_createTime(GetTime.getYMDHM());
		t.setGid(gid);
		t.setMid(mid);
		
		tdao.insert(t);
	}
	public Pager findAll(String gid,int num) {
		return tdao.findPage(gid,num);
		
	}
	public void update(String tid, String name, String begin, String end,
			String dec, String state, String level, String manager,String rate) {
		Task t = new Task();
		t.setT_id(tid);
		t.setT_name(name);
		t.setT_begin(begin);
		t.setT_end(end);
		t.setT_stat(state);
		t.setT_dec(dec);
		t.setT_level(level);
		t.setManager(manager);
		t.setT_rate(rate);
		tdao.update(t);
	}
	
	public List<Task> findMemberTasks(String gid, String mid) {
		
		return tdao.findTask(gid,mid);
	}
	

}
